package com.jzr.bedside.db1.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jzr.bedside.db1.mapper.BedCardMapper;
import com.jzr.bedside.db1.mapper.TBedMapper;
import com.jzr.bedside.db1.model.TBed;
import com.jzr.bedside.db1.service.BedCardService;
import com.jzr.bedside.db1.vo.BedCardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BedCardServiceImpl implements BedCardService {
    @Autowired
    private BedCardMapper bedCardMapper;

    @Autowired
    private TBedMapper bedMapper;

    @Override
    public BedCardVo getBedCardInfo(String deviceNo) {
        return bedCardMapper.getBedCardInfo(deviceNo);
    }

    @Override
    public Integer hasBedId(Integer bedId) {
        List<Integer> list = bedMapper.getIdList(new QueryWrapper<TBed>().eq(TBed.Id_,bedId));
        return list == null || list.size()<=0 ? null : list.get(0);
    }
}
